// pages/test/test.js
const app = getApp()



Page({

    
    
    /**
     * 页面的初始数据
     */
    data: {
        url1:"./img/1.jpg",
        url0:"./img/0.jpg",
        url2:"./img/2.jpg",
        url3:"./img/3.jpg",
        url4:"../../img/meikadeer.jpg",
        url5:"../../img/5.jpg",
        url6:"../../img/6.jpg",
        url7:"../../img/7.jpg",
        url8:"../../img/8.png",
        url9:"../../img/9.jpg",
        url10:"../../img/10.jpg",
        backimg:"",
        day:"",
        month:""
    },

    listen(){
        wx.navigateTo({
          url: '../../pages/play/play',
        })
    },
    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        const myDate=new Date()
        this.setData({
            day:myDate.getDate(),
            month:myDate.getMonth()+1
        })
        
    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {
        this.animation = wx.createAnimation()
        this.animation1 = wx.createAnimation()
        this.animation0 = wx.createAnimation()
        this.animation2 = wx.createAnimation()
        this.animation3 = wx.createAnimation()
        this.animation4 = wx.createAnimation()
        this.animation5 = wx.createAnimation()
        this.animation6 = wx.createAnimation()
        this.animation7 = wx.createAnimation()
        this.animation8 = wx.createAnimation()
    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {

    },
    change:function(){
        app.globalData.i++
        if(app.globalData.i%2 === 0){
            this.animation
            .rotate(-20).step()
            .translate(0, 0).step()
            .scale(1).step()
            this.setData({animation: this.animation.export()}) 

            this.animation1
            .rotate(-10).step()
            .translate(0, 0).step()
            .scale(1).step()
            this.setData({animation1: this.animation1.export()}) 

            this.animation0
            .rotate(-10).step()
            .translate(0, 0).step()
            .scale(1).step()
            this.setData({animation0: this.animation0.export()}) 

            this.animation2
            .rotate(-10).step()
            .translate(0, 0).step()
            .scale(1).step()
            this.setData({animation2: this.animation2.export()})

            this.animation3
            .rotate(-10).step()
            .translate(0, 0).step()
            .scale(1).step()
            this.setData({animation3: this.animation3.export()})

            this.animation4
            .rotate(-10).step()
            .translate(0, 0).step()
            .scale(1).step()
            this.setData({animation4: this.animation4.export()})

            this.animation5
            .rotate(-10).step()
            .translate(0, 0).step()
            .scale(1).step()
            this.setData({animation5: this.animation5.export()})

            this.animation6
            .rotate(-10).step()
            .translate(0, 0).step()
            .scale(1).step()
            this.setData({animation6: this.animation6.export()})

            this.animation7
            .rotate(-10).step()
            .translate(0, 0).step()
            .scale(1).step()
            this.setData({animation7: this.animation7.export()})

            this.animation8
            .rotate(-10).step()
            .translate(0, 0).step()
            .scale(1).step()
            this.setData({animation8: this.animation8.export()})
        }
        // $(this.data.s).prop('src','./img/1.jpg')
    },
    change1:function(){
        this.change();//方法调用要加this
        this.setData({
            url1:this.data.url0
        })
    },
    change2:function(){
        this.change();
        this.setData({
            url1:this.data.url2
        })
    },
    change3:function(){
        this.change();
        this.setData({
            url1:this.data.url3
        })
    },
    change4:function(){
        this.change();
        this.setData({
            url1:this.data.url4
        })
    },
    change5:function(){
        this.change();
        this.setData({
            url1:this.data.url5
        })
    },
    change6:function(){
        this.change();
        this.setData({
            url1:this.data.url6
        })
    },
    change7:function(){
        this.change();
        this.setData({
            url1:this.data.url7
        })
    },
    change8:function(){
        this.change();
        this.setData({
            url1:this.data.url8
        })
    },
    change9:function(){
        this.change();
        this.setData({
            url1:this.data.url9
        })
    },
    change10:function(){
        this.change();
        this.setData({
            url1:this.data.url10
        })
    },
    sese: function () {
        app.globalData.i++

        if(app.globalData.i%2 !== 0){
            //分类图片1
            this.animation.translate(120, 20).step()
            .scale(0.5).step()
            .rotate(20).step()
            this.setData({animation: this.animation.export()}) 
            
            //分类图片2
            this.animation1.translate(80, 90).step()
            .scale(0.5).step()
            .rotate(10).step()
            this.setData({animation1: this.animation1.export()})
            //分类图片3
            this.animation0.translate(0, 120).step()
            .scale(0.5).step()
            .rotate(10).step()
            this.setData({animation0: this.animation0.export()})
            //分类图片3
            this.animation2.translate(-150, -120).step()
            .scale(0.5).step()
            .rotate(10).step()
            this.setData({animation2: this.animation2.export()})
            //分类图片4
            this.animation3.translate(140, 140).step()
            .scale(0.5).step()
            .rotate(10).step()
            this.setData({animation3: this.animation3.export()})
            //分类图片5
            this.animation4.translate(-10, -120).step()
            .scale(0.5).step()
            .rotate(10).step()
            this.setData({animation4: this.animation4.export()})
            //分类图片6
            this.animation5.translate(-120, -10).step()
            .scale(0.5).step()
            .rotate(10).step()
            this.setData({animation5: this.animation5.export()})
            //分类图片7
            this.animation6.translate(-80, -80).step()
            .scale(0.5).step()
            .rotate(10).step()
            this.setData({animation6: this.animation6.export()})
            //分类图片8
            this.animation7.translate(140, -120).step()
            .scale(0.5).step()
            .rotate(10).step()
            this.setData({animation7: this.animation7.export()})
            //分类图片9
            this.animation8.translate(-150, 140).step()
            .scale(0.5).step()
            .rotate(10).step()
            this.setData({animation8: this.animation8.export()})
        } 
    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {

    }
})